🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / common / src / commonMain / kotlin / org / meshtastic / core / common / util / TimeUtils.kt
Displaying Raw • Download
core/common/src/commonMain/kotlin/org/meshtastic/core/common/util/TimeUtils.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 1.59 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.common.util
Tff7b72import T7ee787kotlinx.datetime.TimeZone
Tff7b72import T7ee787kotlin.time.Clock
Tff7b72import T7ee787kotlin.time.Instant
T8b949e/** Accessor for the current time in milliseconds. */
Tff7b72val Te6edf3nowMillisTb4b4b4: Tffa657Long
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3nowInstantTb4b4b4.Te6edf3toEpochMillisecondsTb4b4b4(Tb4b4b4)
T8b949e/** Accessor for the current time as a stable [Instant]. */
Tff7b72val Te6edf3nowInstantTb4b4b4: Te6edf3Instant
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3ClockTb4b4b4.Te6edf3SystemTb4b4b4.Te6edf3nowTb4b4b4(Tb4b4b4)
T8b949e/** Accessor for the current time in seconds. */
Tff7b72val Te6edf3nowSecondsTb4b4b4: Tffa657Long
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3nowInstantTb4b4b4.Te6edf3epochSeconds
T8b949e/** Accessor for the system default time zone. */
Tff7b72val Te6edf3systemTimeZoneTb4b4b4: Te6edf3TimeZone
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3TimeZoneTb4b4b4.Te6edf3currentSystemDefaultTb4b4b4(Tb4b4b4)
T8b949e/** Clamps a seconds-since-epoch timestamp so it never exceeds the current wall-clock time. */
Tff7b72fun Td2a8ffclampTimestampToNowTb4b4b4(Te6edf3epochSecondsTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Tffa657Int Tff7b72= Te6edf3minOfTb4b4b4(Te6edf3epochSecondsTb4b4b4, Te6edf3nowSecondsTb4b4b4.Te6edf3toIntTb4b4b4(Tb4b4b4)Tb4b4b4)
T8b949e/** Converts these milliseconds to an [Instant]. */
Tff7b72fun Te6edf3LongTb4b4b4.Td2a8fftoInstantTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3Instant Tff7b72= Te6edf3InstantTb4b4b4.Te6edf3fromEpochMillisecondsTb4b4b4(Tff7b72thisTb4b4b4)
Served by rngit 1.5.0 - Generated in 0.04s